namespace SS.Common.Collection
{
    #region Used namespaces

    using System.Collections;
    using System.Collections.Generic;

    #endregion

    /// <summary>
    /// Interface for conncurent collection
    /// </summary>
    /// <typeparam name="T">
    /// Collection item type
    /// </typeparam>
    public interface IConcurrentCollection<T> : IEnumerable<T>, ICollection
    {
        /// <summary>
        /// Add an item to the collection
        /// </summary>
        /// <param name="item">
        /// The item to add
        /// </param>
        /// <returns>
        /// true if successfully added
        /// </returns>
        bool Add(T item);

        /// <summary>
        /// Remove the 'last' item from the collection
        /// </summary>
        /// <param name="item">
        /// Item has been removed
        /// </param>
        /// <returns>
        /// true if successfully removed
        /// </returns>
        bool Remove(out T item);

        /// <summary>
        /// Copy all members to a new array
        /// </summary>
        /// <returns>
        /// The returned array
        /// </returns>
        T[] ToArray();
    }
}
